import os 
import time
#输出当前工作目录
print(os.getcwd()) # 获取当前工作目录

name="zhangsan"
age=20
text="name:%s,age:%d"%(name,age)

#当前目录写入文件
with open("example.txt", "a") as file:
    file.write("\n Hello, World!")
    
with open("example.txt", "a") as file:
    file.write("\n name:{} age:{} at:{}".format(name,age,time.ctime()))
    
current_time = time.time()
current_time_formatted = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(current_time))

with open("example.txt", "a") as file:
    file.write("\n write time format at:{}".format(current_time_formatted))
    
#读取文件
with open("example.txt", "r") as file:
    print(file.read())